package inabit.expressioncompiler.productions;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.expressioncompiler.lexical.ExpressionTokenClass;
import inabit.expressioncompiler.parser.ExpressionSemanticAction;

/**J -> (U)*/
/**@author Rafael Rocha*/
public class J_Rule extends Production{
	private NonTerminal U;
	public J_Rule() {
		super("J");
	}
	
	public Symbol[] production(final NonTerminal nonTerminal) {
		U = new NonTerminal("U");
		Symbol[] symbols = {
			new Terminal(ExpressionTokenClass.OPEN_PARENTHESIS),
			U,
			new Terminal(ExpressionTokenClass.CLOSE_PARENTHESIS),
			new ExpressionSemanticAction(nonTerminal) {
				public void execute() {
					nonTerminal.code = U.code;
				}
			}
		};
		return symbols;
	}
}
